package com.oceansoft.core.system.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.hui.platform.framework.dao.util.QueryUtil;
import com.oceansoft.core.system.dao.ISysDictDao;
import com.oceansoft.core.system.domain.SysDict;

@Repository
public class SysDictDaoImpl implements ISysDictDao{
	@Resource
	private JdbcTemplate jt;
	
	@Override
	public List<SysDict> query(String dictType) {
		String sql = "select * from T_SYS_DICT where substr(code,1,1)='2' and dict_type='物品状态' order by dbid ";
		QueryUtil qu = new QueryUtil();
		qu.setWholeSQL(sql);
		qu.setViewClazz(SysDict.class);
		List<SysDict> list = qu.list();
		return list;
	}
	
	@Override
	public SysDict queryByCodeAndType(String code, String dictType) {
		String sql = "select * from T_SYS_DICT where code='"+code+"' and dict_type='"+dictType+"' ";
		QueryUtil qu = new QueryUtil();
		qu.setWholeSQL(sql);
		qu.setViewClazz(SysDict.class);
		List<SysDict> list = qu.list();
		if(null != list && list.size() > 0){
			return list.get(0);
		}else{
			return null;
		}
	}
	
	
}
